﻿using MediatR;
using SheepStorage.API.Application.Command.BuildingManagementCommand;
using SheepStorage.API.Application.Command.DepartmentCommand;
using SheepStorage.API.Baseclass;
using SheepStorage.Domain.Entity;
using SheepStorage.Service.DataImp;
using SheepStorage.Service.Interface;

namespace SheepStorage.API.Application.CommandHandlers.DepartmentHandler
{
    public class DepartmentFtHandler : IRequestHandler<DepartmentFtCommand, Results<Department>>
    {

        private readonly IDepartmentService departmentService;

        public DepartmentFtHandler(IDepartmentService departmentService)
        {
            this.departmentService = departmentService;
        }
        public async Task<Results<Department>> Handle(DepartmentFtCommand request, CancellationToken cancellationToken)
        {
            return Results<Department>.DataResult(departmentService.GetFtDepartment(request.DepartmentId));
        }
    }
}
